Skip to content

Fix #132: correct tab order in New Connection dialog (General & Groups)#271

Open
eran132 wants to merge 1 commit into
Terminals-Origin:masterfrom
eran132:fix/132-newconnection-tab-order
Open

Fix #132: correct tab order in New Connection dialog (General & Groups)#271
eran132 wants to merge 1 commit into
Terminals-Origin:masterfrom
eran132:fix/132-newconnection-tab-order

Conversation

@eran132

@eran132 eran132 commented Jun 6, 2026

Copy link
Copy Markdown

Summary

Fixes #132. The General and Groups sections of the New Connection dialog had random / colliding TabIndex values, so keyboard navigation jumped around the form instead of following the visible layout.

Examples of the problem in the current code:

  • GroupsControl had three controls at TabIndex = 0 and three at TabIndex = 1 (lvConnectionTags, AllTagsListView, txtGroupName, btnRemoveTag, AllTagsAddButton …).
  • GeneralPropertiesUserControl had chkSavePassword at TabIndex = 6 while the fields above it (cmbServers, txtPort, txtName) sat at 24–28, so Tab jumped from the bottom checkbox back up to the server field.

Change

Reassigned TabIndex on both user controls to follow the visible reading order (top‑to‑bottom, then left‑to‑right). Only TabIndex values change — no layout, control, or behavior changes. Mnemonic labels now sit immediately before their field, so Alt‑mnemonics focus the intended control.

Tests

Added Source/Tests/UserInterface/NewTerminalTabOrderTests.cs (4 tests) asserting, for each section, that:

  1. focusable controls in tab order follow reading order (never jump back up the form), and
  2. focusable controls do not share a TabIndex.

Verified the tests are meaningful: they fail on the pre‑fix designers and pass after the fix. The rest of the suite is unchanged (the only pre‑existing failures locally are the SQL/LocalDB persistence tests, which need a database).

🤖 Generated with Claude Code

The General and Groups sections of the New Connection dialog had random
and colliding TabIndex values (e.g. multiple controls at TabIndex 0/1 in
Groups, and Save-password at TabIndex 6 in General), which made keyboard
navigation jump around the form.

Reassign TabIndex on both user controls to follow the visible reading
order (top to bottom, then left to right). No layout or behavior changes;
only TabIndex values are altered.

Adds NewTerminalTabOrderTests asserting each section's tab order follows
reading order and that focusable controls do not share a tab index.

Fixes Terminals-Origin#132

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 6, 2026 09:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds regression tests to prevent tab-order regressions in the “New Connection” dialog UI, specifically ensuring consistent keyboard navigation for the General and Groups sections (issue #132).

Changes:

  • Added MSTest coverage that validates tab order follows visual reading order (top-to-bottom, left-to-right).
  • Added MSTest coverage that asserts focusable controls don’t share TabIndex values.
  • Registered the new test file in the Tests project.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 4 comments.

File Description
Source/Tests/UserInterface/NewTerminalTabOrderTests.cs Introduces new UI regression tests for tab order reading-order and TabIndex uniqueness.
Source/Tests/Tests.csproj Includes the new test file in compilation.
Files not reviewed (2)
  • Source/Terminals/Forms/EditFavorite/GeneralPropertiesUserControl.Designer.cs: Language not supported
  • Source/Terminals/Forms/EditFavorite/GroupsControl.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +95 to +100
private static IEnumerable<Control> FocusableControls(Control container)
{
// Labels (TabStop == false) and hidden alternates are skipped by real tab
// navigation, so they are excluded here too.
return container.Controls.Cast<Control>().Where(c => c.TabStop && c.Visible);
}
Comment on lines +25 to +30
[TestMethod]
public void GeneralProperties_TabOrder_FollowsReadingOrder()
{
using (var control = new GeneralPropertiesUserControl())
AssertReadingOrder(control);
}
Comment on lines +16 to +18
[TestClass]
public class NewTerminalTabOrderTests
{
Comment on lines +19 to +23
/// <summary>
/// Controls on the same visual row may differ slightly in Top (a label and
/// its field are not pixel aligned). Treat anything within this band as one row.
/// </summary>
private const int RowTolerance = 12;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Wrong tab order in 'New Connection' dialog

2 participants